package com.pyip.order;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import com.pyip.feign.client.UserClient;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
//import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

//@EnableFeignClients(basePackages = "cn.itcast.feign.clients")
@MapperScan("com.pyip.order.mapper")
@SpringBootApplication
@EnableFeignClients(clients = {UserClient.class})
//@EnableEurekaClient
// 全局配置和指定配置
//@EnableFeignClients(defaultConfiguration = DefaultFeignConfiguration.class)
//@FeignClient(value = "userservice",configuration = DefaultFeignConfiguration.class)
public class OrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }

    // 添加restTemplate
//    @Bean
//    @LoadBalanced
//    public RestTemplate restTemplate(){
//        return new RestTemplate();
//    }




//    自定义负载均衡策略
//    全局影响
//    @Bean
//    public IRule randomRule(){
//        return new RandomRule();
//    }
}